/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.Scanner;

/**
 * <p>Project: jse2204 - Reg6
 * <p>Powered by webrx On 2022-09-14 15:00:51
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Reg6 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
            System.out.print("请输入姓名：");
            String name = sc.nextLine().trim();
            if(name.equals("exit") || name.equals("quit")){
                System.out.println("bye...");
                break;
            }
            if (name.matches("^[a-zA-Z]{6,20}+|[\\u4e00-\\u9fa5]{2,6}$")) {
                System.out.printf("恭喜：%s，注册成功。%n", name);
            } else {
                System.out.printf("遗憾，注册失败，姓名填写不符合规则。%n");
            }
            System.out.println();
            System.out.println();
        }
    }
}
